package com.cloud.wms.ui.returned.entity;

import android.os.Parcel;
import android.os.Parcelable;

import com.cloud.wms.ui.main.entity.BatchEntity;
import com.cloud.wms.ui.main.entity.CommodityEntity;

import java.util.ArrayList;

/**
 * @Author： Chen
 * @Date： 2021/5/19
 * @Desc：
 */
public class InventoryInfoEntity implements Parcelable {

    /**
     * ShipOrderCode : incididunt culpa
     * ExpressDeliveryCode : dolor
     * commodityList : [{"commodityID":-5.721935013582642E7,"stockType":6.257233869543296E7,"amount":4.8260828421718895E7,"batchInfos":{"productionDate":"quis laborum","productBatchID":64832445,"inDate":"nisi","expirationDate":"nisi eiusmod veniam irure Lorem"},"IsNeedLogistics":"exercitation Ut culpa dolor"},{"commodityID":-2.2046743757498443E7,"stockType":5.642008682817146E7,"amount":2309343.1928475946,"batchInfos":{"productionDate":"officia ut veniam consequat id","productBatchID":-4716279,"inDate":"anim sint irure aute occaecat","expirationDate":"eiusmod culpa amet sed magna"},"IsNeedLogistics":"ea eiusmod et laborum amet"}]
     */

    private String shipOrderCode;
    private String expressDeliveryCode;
    private ArrayList<CommodityListBean> commodityList;

    public String getShipOrderCode() {
        return shipOrderCode;
    }

    public void setShipOrderCode(String ShipOrderCode) {
        this.shipOrderCode = ShipOrderCode;
    }

    public String getExpressDeliveryCode() {
        return expressDeliveryCode;
    }

    public void setExpressDeliveryCode(String ExpressDeliveryCode) {
        this.expressDeliveryCode = ExpressDeliveryCode;
    }

    public ArrayList<CommodityListBean> getCommodityList() {
        return commodityList;
    }

    public void setCommodityList(ArrayList<CommodityListBean> commodityList) {
        this.commodityList = commodityList;
    }

    public static class CommodityListBean extends CommodityEntity {
        /**
         * commodityID : -5.721935013582642E7
         * stockType : 6.257233869543296E7
         * amount : 4.8260828421718895E7
         * batchInfos : {"productionDate":"quis laborum","productBatchID":64832445,"inDate":"nisi","expirationDate":"nisi eiusmod veniam irure Lorem"}
         * IsNeedLogistics : exercitation Ut culpa dolor
         */

        private ArrayList<BatchInfoBean> batchInfos;
        private boolean isNeedLogistics;

        public ArrayList<BatchInfoBean> getBatchInfo() {
            return batchInfos;
        }

        public void setBatchInfo(ArrayList<BatchInfoBean> batchInfos) {
            this.batchInfos = batchInfos;
        }

        public boolean isNeedLogistics() {
            return isNeedLogistics;
        }

        public void setIsNeedLogistics(boolean IsNeedLogistics) {
            this.isNeedLogistics = IsNeedLogistics;
        }

        public static class BatchInfoBean extends BatchEntity {
//            private int amount;
//            private boolean isSelect;

            public boolean isSelect() {
                return isSelect;
            }

            public void setSelect(boolean select) {
                isSelect = select;
            }

            public int getAmount() {
                return amount;
            }

            public void setAmount(int amount) {
                this.amount = amount;
            }

            public BatchInfoBean() {
            }

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                super.writeToParcel(dest, flags);
                dest.writeInt(this.amount);
                dest.writeByte(this.isSelect ? (byte) 1 : (byte) 0);
            }

            protected BatchInfoBean(Parcel in) {
                super(in);
                this.amount = in.readInt();
                this.isSelect = in.readByte() != 0;
            }

            public static final Creator<BatchInfoBean> CREATOR = new Creator<BatchInfoBean>() {
                @Override
                public BatchInfoBean createFromParcel(Parcel source) {
                    return new BatchInfoBean(source);
                }

                @Override
                public BatchInfoBean[] newArray(int size) {
                    return new BatchInfoBean[size];
                }
            };
        }

        public CommodityListBean() {
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            super.writeToParcel(dest, flags);
            dest.writeTypedList(this.batchInfos);
            dest.writeByte(this.isNeedLogistics ? (byte) 1 : (byte) 0);
        }

        protected CommodityListBean(Parcel in) {
            super(in);
            this.batchInfos = in.createTypedArrayList(BatchInfoBean.CREATOR);
            this.isNeedLogistics = in.readByte() != 0;
        }

        public static final Creator<CommodityListBean> CREATOR = new Creator<CommodityListBean>() {
            @Override
            public CommodityListBean createFromParcel(Parcel source) {
                return new CommodityListBean(source);
            }

            @Override
            public CommodityListBean[] newArray(int size) {
                return new CommodityListBean[size];
            }
        };
    }

    public InventoryInfoEntity() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.shipOrderCode);
        dest.writeString(this.expressDeliveryCode);
        dest.writeTypedList(this.commodityList);
    }

    protected InventoryInfoEntity(Parcel in) {
        this.shipOrderCode = in.readString();
        this.expressDeliveryCode = in.readString();
        this.commodityList = in.createTypedArrayList(CommodityListBean.CREATOR);
    }

    public static final Creator<InventoryInfoEntity> CREATOR = new Creator<InventoryInfoEntity>() {
        @Override
        public InventoryInfoEntity createFromParcel(Parcel source) {
            return new InventoryInfoEntity(source);
        }

        @Override
        public InventoryInfoEntity[] newArray(int size) {
            return new InventoryInfoEntity[size];
        }
    };
}
